const { genResponse } = require("../utils")
const WxRedis = require('../redis/weixin')

/** 检查 access_token */
module.exports.accessTokenCheck = async function(ctx, next) {
  const access_token = await WxRedis.AccessToken.get()
  if (!access_token) {
    ctx.body = genResponse(false, '请重新获取微信 Access Token')
    return
  }
  next()
}